

import 'dart:convert';

import 'package:dio/dio.dart';

import '../config/dioConfig.dart';

Future<Map> saveOrdersApi(Map data) async {
  //解析返回结果
  var res = await HttpManager.getInstance().request(
      method:  "post",
      "/orders/save",
      params: data
  );
  return jsonDecode(res.toString());
}

Future<Map> getOrderByIdApi(id) async {
  var res = await HttpManager.getInstance().get(
    "/orders/getById/${id}",
    option: Options(responseType: ResponseType.plain),
  );
  return jsonDecode(res.toString());}


Future<Map> getAllOrderApi() async {
  var res = await HttpManager.getInstance().get(
    "/orders/getAll",
    option: Options(responseType: ResponseType.plain),
  );
  return jsonDecode(res.toString());}


Future<Map> updateOrderStateApi(Map data) async {
  var res = await HttpManager.getInstance().request(
      method:  "post",
      "/orders/updateState",
      params: data
  );
  return jsonDecode(res.toString());}